package com.dmjj.limit.service.impl;

import com.dmjj.common.base.BaseMapper;
import com.dmjj.common.base.BaseServiceImpl;
import com.dmjj.common.base.LoginEntity;
import com.dmjj.limit.dao.RoleMapper;
import com.dmjj.limit.dto.RoleDTO;
import com.dmjj.limit.service.RoleService;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;


/**
 * ${comments}业务处理接口
 * @Author zhangxue
 * @Date 2019-03-21 09:40:56
 */
@Service
public class RoleServiceImpl extends BaseServiceImpl<RoleDTO, Long> implements RoleService {

    private static final Log LOGGER = LogFactory.getLog(RoleServiceImpl.class);

    @Autowired
    private RoleMapper mapper;

    @Override
    protected BaseMapper<RoleDTO, Long> getMapper() {
        return mapper;
    }

    /**
     * ${comments}列表
     * @Author zhangxue
     * @Date 2019-03-21 09:40:56
     * @Param
     * @Return
     */
    @Override
    public List<RoleDTO> list4Page(RoleDTO entity, Integer pageNum, Integer... pageSize) {
        return super.list4Page(entity, pageNum, pageSize);
    }

    /**
     * ${comments}列表（无分页）
     * @Author zhangxue
     * @Date 2019-03-21 09:40:56
     * @Param
     * @Return
     */
    @Override
    public List<RoleDTO> listByCondition(RoleDTO entity) {
        return super.listByCondition(entity);
    }

    /**
     * 查询${comments}详情信息
     * @Author zhangxue
     * @Date 2019-03-21 09:40:56
     * @Param
     * @Return
     */
    @Override
    public RoleDTO queryOneByPk(Long id) {
        return super.queryOneByPk(id);
    }

    /**
     * 保存${comments}信息
     * @Author zhangxue
     * @Date 2019-03-21 09:40:56
     * @Param
     * @Return
     */
    @Override
    @Transactional
    public Long save(RoleDTO entity) {
        return super.save(entity);
    }

    /**
     * 删除${comments}信息
     * @Author zhangxue
     * @Date 2019-03-21 09:40:56
     * @Param
     * @Return
     */
    @Override
    @Transactional
    public Integer delete(Long id) {
        return super.delete(id);
    }

    /**
     * 编辑角色表信息
     * @Author zhangxue
     * @Date 2019-03-21 09:40:56
     * @Param
     * @Return
     */
    @Override
    @Transactional
    public Integer update(RoleDTO entityDTO) {
        return mapper.update(entityDTO);
    }

    /**
     * 获取用户角色权限与数据权限
     * @Author zhangxue
     * @Date 2019-03-21 09:40:56
     * @Param
     * @Return
     */
    @Override
    public Map<String, Object> queryUserLimitByToken(LoginEntity loginEntity) {
        return mapper.queryUserLimitByToken();
    }
}
